package com.yang.Test_;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description: TODO
 * @Author: Yang
 * @DateTime: 2024/5/8 10:18
 **/
public class test1 {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<String>();
        ArrayList<String> list2 = new ArrayList<String>();
        list1.add("1");
        list1.add("2");
        list1.add("3");
        list1.add("4");

        list2.add("1");
        list2.add("2");
        List<String> resList = list1.stream().filter(item->!list2.contains(item)).collect(Collectors.toList());
        for (String res : resList){
            System.out.println("res = " + res);
        }
    }
}
